// src/stores/auth.ts
import { defineStore } from 'pinia'

export const useAuthStore = defineStore('auth', {
  state: () => ({
    permissions: [] as string[]
  }),
  actions: {
    setPermissions(permissions: string[]) {
      this.permissions = permissions
    },
    hasPermission(permission: string): boolean {
      return this.permissions.includes(permission)
    }
  },
  persist: true // 建议持久化存储
})